﻿@using Infrastructure.Web;
@{
    ViewBag.Title = "考勤管理系统";
    Layout = "~/Views/Shared/_Index.cshtml";
}

<script type="text/javascript">
    //$(function () {
    //    $('#timepicker').timepicker({
    //        minTime: '7a',
    //        maxTime: '8p',
    //        scrollbar: true,
    //        format: 'hh:ii'
    //    });
    //});
</script>
<body style="background-color:#1c77ac; background-image:url(../Content/UI/images/light.png); background-repeat:no-repeat; background-position:center top; overflow:hidden;">
    <div id="mainBody">
        <div id="cloud1" class="cloud"></div>
        <div id="cloud2" class="cloud"></div>
    </div>
    @*<div class="logintop">
            <span>欢迎登录后台管理界面平台</span>
            <ul>
                <li><a href="#">回首页</a></li>
                <li><a href="#">帮助</a></li>
                <li><a href="#">关于</a></li>
            </ul>
        </div>*@
    <div class="loginbody">

        <span class="systemlogo"></span>

        <div class="loginbox">

            <ul>

                <li><input name="" id="UserName" type="text" class="loginuser" value="@WebHelper.GetCookie("UserName")" onclick="JavaScript:this.value=''" /></li>
                <li><input name="" id="Password" type="password" class="loginpwd" value="@WebHelper.GetCookie("Password")" onclick="JavaScript:this.value=''" /></li>
                <li>
                    <input name="" type="button" id="login-button" class="loginbtn" value="登录" />
                    <label><input name="IsRemeber" type="checkbox" value="1" checked="checked" id="IsRemeber" />记住密码</label>
                    @*<label><a href="#">忘记密码？</a></label>*@
                </li>
            </ul>
        </div>
    </div>
    <div class="loginbm"></div>
</body>
<script type="text/javascript">
    $(function () {
        $('.loginbox').css({ 'position': 'absolute', 'left': ($(window).width() - 692) / 2 });
        $(window).resize(function () {
            $('.loginbox').css({ 'position': 'absolute', 'left': ($(window).width() - 692) / 2 });
        })
    });
    function loginModel() {
        return {
            UserName: $("#UserName").val(),
            Password: $("#Password").val(),
            IsRemeber: document.getElementsByName("IsRemeber")[0].checked
        }
    }
    $(function () {
        $("body").keydown(function () {
            if (event.keyCode == "13") {//keyCode=13是回车键
                $('#login-button').click();
            };
        });
        $('#login-button').click(function () {
            if ($("#UserName").val() == "" || $("#Password").val() == "") {
                layer.msg("用户名或密码不能为空");
                return;
            }
            $.post("/Home/LoginAjax", loginModel(), function (data) {
                if (data.state == 1) {
                    $('form').fadeOut(500);
                    $('.wrapper').addClass('form-success');
                    top.location.href = "/Home/NewView";
                }
                else {
                    layer.msg(data.message);
                }

            });

        });

    })

</script>
</html>
